home *** CD-ROM | disk | FTP | other *** search
- /*
- File: SNMP.h
-
- Contains: Constants, typedefs, etc for SNMP
-
- Copyright: © 1991-1992 by Apple Computer, Inc., all rights reserved.
-
- */
- /***********************************************************
- Copyright 1988, 1989 by Carnegie Mellon University
-
- All Rights Reserved
-
- ******************************************************************/
-
- #ifndef __SNMP__
- #define __SNMP__
-
-
- /**********************************************************************
- * Macros
- **********************************************************************/
-
- #define kDynamicArray 1 // array could have more that one item
-
- /**********************************************************************
- * SNMP Variable types
- **********************************************************************/
- #include <SNMPVarTypes.h>
-
- /**********************************************************************
- * Other Constants
- **********************************************************************/
- // the currently supported version of snmp
- #define kCurrentSNMPVersion 0
-
- #define kMaxIDCount 25 // max number of sub ids in an object id
-
- #define kMaxCommunities 16 // max number of communites
- #define kMyPrecedence 128
- #define kMaxNameLen 32 // max length for agent, group, and variable names
-
- /**********************************************************************
- * Typedefs
- **********************************************************************/
-
- typedef unsigned long ASNTagType;
-
- // SMI Access Modes
-
- enum {
- smiReadOnly = 0,
- smiWriteOnly,
- smiReadWrite,
- smiNotAccessible
- };
-
- typedef short SMIAccess;
-
- // SNMP Manager specific typedefs
-
- typedef unsigned long SNMPRefNum; // unique ID for SNMP Manger clients
-
- // Error codes for SNMP Manager
-
- #define ErrorCodeBase -25500
-
- enum {
- snmpNoError = 0,
- snmpBadID = ErrorCodeBase - 1,
- snmpNoMoreMIB = ErrorCodeBase - 2,
- snmpEndOfColumn = ErrorCodeBase - 3,
- snmpBufTooSmall = ErrorCodeBase - 4,
- snmpDuplicateVar = ErrorCodeBase - 5,
- snmpDupPrecedence = ErrorCodeBase - 6,
- snmpNoVarFound = ErrorCodeBase - 7,
- snmpMemError = ErrorCodeBase - 8,
- snmpGenError = ErrorCodeBase - 9,
- snmpBadParm = ErrorCodeBase - 10,
- snmpMalformedID = ErrorCodeBase - 11,
- snmpBTreeError = ErrorCodeBase - 12,
- snmpNotFound = ErrorCodeBase - 13,
- snmpDupAgentName = ErrorCodeBase - 14,
- snmpDupGroupID = ErrorCodeBase - 15,
- snmpBadValue = ErrorCodeBase - 16,
- snmpEnd = ErrorCodeBase - 32
- };
-
- typedef short SNMPError;
-
- //
- // interface descriptions and locations
- //
- // if description is for a slot, location is the slot number
- // if description is for Enet0, location is ignored
- // if description is for localtalk, location is kIFLoc_LTalkPortB or kIFLoc_LTalkPortA
- //
- // if the index is known then kIFunknownIndex is returned
- //
-
- #define kIFunknownIndex 0xffffffff
-
- #define kIFdescr_Slot 0
- #define kIFdescr_Enet0 -1
- #define kIFdescr_LTalk -2
-
- #define kIFLoc_LTalkPortB 1
- #define kIFLoc_LTalkPortA 2
-
-
- // SNMP generic trap codes
-
- enum{
- snmpColdStart = 0,
- snmpWarmStart,
- snmpLinkDown,
- snmpLinkUp,
- snmpAuthenticationFailure,
- snmpEGPNeighborLoss,
- snmpEnterpriseSpecific
- };
-
- typedef short SNMPTrapCode;
-
- // for Set Variable Routines
-
- enum SetStage {
- setAllocate = 0,
- setConsistency,
- setChange,
- setRevert
- };
-
- typedef enum SetStage SetStage;
-
-
- // Explicit unique name for a MIB variable (object identifier)
-
- struct ObjectID {
- unsigned short count; // count of ids
- unsigned long id[kDynamicArray]; // ordered array of ids
- };
-
- typedef struct ObjectID ObjectID;
- typedef ObjectID* ObjectIDPtr;
-
-
- // A linked list of object identifiers
-
- struct ObjectIDList {
- struct ObjectIDList* nextObjID; // NULL at end of list
- ObjectID anObjID; // an object identifier
- };
-
- typedef struct ObjectIDList ObjectIDList;
- typedef ObjectIDList* ObjectIDListPtr;
-
-
- // MIB variable data.
-
- struct MIBVariable {
- ASNTagType type; // ASN.1 Type of this MIB variable
- short dataSize; // size of data buffer
- char* dataPtr; // pointer to data buffer
- ObjectIDPtr idPtr; // explicit unqiue identifier
- };
-
- typedef struct MIBVariable MIBVariable;
- typedef MIBVariable* MIBVariablePtr;
-
-
- // A linked list of MIB variables
-
- struct MIBlet {
- struct MIBlet* nextMIBlet; // NULL for last variable
- MIBVariable mibVar; // a MIB Variable
- };
-
- typedef struct MIBlet MIBlet;
- typedef MIBlet* MIBletPtr;
-
-
- // for variable sets and gets
-
- struct VarBuf{
- unsigned int maxlen;
- unsigned int len;
- char* buf;
- };
-
- typedef struct VarBuf VarBuf;
- typedef VarBuf* VarBufPtr;
-
-
- /**********************************************************************
- ** SNMP Transport specific types
- **********************************************************************/
- typedef long TransportTag; // unique to the Transport across boots
- typedef void* TIAddressPtr; // Transport Independent (opaque) network address
-
- // Raw SNMP packets
- // last PacketPiece has length zero and no pointer (à la Write Data Structure)
-
- struct PacketPiece {
- short length;
- char* dataPtr;
- };
-
- typedef struct PacketPiece PacketPiece;
- typedef PacketPiece* PacketPiecePtr;
-
-
- #endif /* __SNMP__ */
-